-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add support for HTTPRoutePolicy in HTTPRoute reconciliation #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit updates the `HTTPRoutePolicy` CRD with more detailed validation for Kubernetes object references, adds status and ancestor information to the policy, and updates the corresponding controller and test files. Additionally, it refactors the `StringOrSlice` type and adjusts the indexing and translation logic.
This commit refactors the `common` package by moving the `Vars` and `StringOrSlice` types to the `adc` package. It also updates the `TargetReference` type to use `LocalPolicyTargetReferenceWithSectionName` from `gateway-api` and simplifies the CRD documentation. Additionally, it adjusts the import paths and type references in the `httproute.go` file to reflect these changes.
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-04-17T10:02:00Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: API7
project: api7-ingress-controller
url: https://github.com/api7/api7-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
failedTests:
- HTTPRoutePathMatchOrder
- HTTPRouteSimpleSameNamespace
result: failure
skippedTests:
- GatewayInvalidTLSConfiguration
- GatewaySecretInvalidReferenceGrant
- GatewaySecretMissingReferenceGrant
- GatewaySecretReferenceGrantAllInNamespace
- GatewaySecretReferenceGrantSpecific
- HTTPRouteExactPathMatching
- HTTPRouteHTTPSListener
- HTTPRouteHeaderMatching
- HTTPRouteHostnameIntersection
- HTTPRouteInvalidBackendRefUnknownKind
- HTTPRouteInvalidCrossNamespaceBackendRef
- HTTPRouteInvalidCrossNamespaceParentRef
- HTTPRouteInvalidNonExistentBackendRef
- HTTPRouteInvalidParentRefNotMatchingSectionName
- HTTPRouteInvalidReferenceGrant
- HTTPRouteListenerHostnameMatching
- HTTPRouteMatching
- HTTPRouteMatchingAcrossRoutes
- HTTPRoutePartiallyInvalidViaInvalidReferenceGrant
- HTTPRouteReferenceGrant
- HTTPRouteRequestHeaderModifier
- HTTPRouteWeight
statistics:
Failed: 2
Passed: 9
Skipped: 22
name: GATEWAY-HTTP
summary: Core tests failed with 2 test failures. |
The `updateHTTPRoutePolicyStatus` function is replaced with `modifyHTTPRoutePolicyStatus` to streamline the process, and a new function `clearHTTPRoutePolicyRedundantAncestor` is introduced to remove redundant ancestors. Additionally, the group in the test's targetRefs is updated to `gateway.networking.k8s.io`.
Remove unnecessary `kind` fields and list map keys in the HTTPRoutePolicy CRD. Add a new generic event channel and update predicates for more efficient event handling in the HTTPRouteReconciler.
This commit refactors the handling of HTTPRoutePolicy, including moving the `httpRoutePolicyPredicateOnUpdate` function and updating the type definitions. It also updates the e2e test for HTTPRoute to correct a typo in the test description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
| Loop: | ||
| for _, items := range c.policies { | ||
| for _, item := range items { | ||
| if item.Spec.Priority != policy.Spec.Priority || *item.Spec.Priority != *policy.Spec.Priority { |
Copilot
AI
Apr 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition combining a direct pointer comparison and a dereferenced value comparison is redundant and could potentially lead to a nil pointer dereference if either Spec.Priority is nil. Consider adding explicit nil checks and simplifying the comparison logic.
| if item.Spec.Priority != policy.Spec.Priority || *item.Spec.Priority != *policy.Spec.Priority { | |
| if item.Spec.Priority == nil || policy.Spec.Priority == nil { | |
| if item.Spec.Priority != policy.Spec.Priority { // One is nil, the other is not | |
| c.conflict = true | |
| break Loop | |
| } | |
| } else if *item.Spec.Priority != *policy.Spec.Priority { |
The import statements in `httproute_controller.go`, `httproutepolicy.go`, and `httproute.go` have been reordered to improve readability and maintain a consistent style across the files.
Type of change:
What this PR does / why we need it:
Pre-submission checklist: